package com.lagou.work.interceptor;

import com.lagou.work.dao.ResumeDao;
import com.lagou.work.pojo.Resume;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * ClassName LogIntercepter
 *
 * @Description // TODO
 * @Author zhengkunqi
 * @Date 2020/7/21
 * Version 1.0
 **/
public class LoginIntercepter implements HandlerInterceptor {

    @Autowired
    private ResumeDao resumeDao;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String id = request.getParameter("id");
        String name = request.getParameter("name");
        Resume resume = resumeDao.findBySql(Integer.parseInt(id), name);
        if (resume != null) {
            return true;
        }
        return false;
    }

}
